//
//  RootViewController.m
//  OpenGL_ES_Demo
//
//  Created by Wang Shuguang on 12-12-24.
//  Copyright (c) 2012年 elong. All rights reserved.
//

#import "RootViewController.h"
#import "GLView.h"
#import "EAGLView.h"
#import "ES1Renderer.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (id) init{
    if (self = [super init]) {

    }
    return self ;
}

- (void) stopMotionListen{
    
    if (eaglView) {
        [eaglView stopAnimation];
        [eaglView removeFromSuperview];
        
        eaglView = nil;
    }
}

- (void) startMotionListen{
    if (!eaglView) {
        eaglView = [[EAGLView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        [self.view addSubview:eaglView];
        [eaglView release];
        [eaglView startAnimation];

    }
    
}

- (void) viewWillAppear:(BOOL)animated{
    NSLog(@"view will appear");
}



- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (BOOL) shouldAutorotate{
    return NO;
}


@end
